package routes

import (
	"arlog/api/v1"
	log "arlog/core/logs"
	"arlog/middleware"
	"arlog/utils/res"
	"github.com/gin-gonic/gin"
)

func WebInit() {

	r := gin.New()

	r.Use(log.LoggerToFile(), gin.Recovery(), middleware.Cors())

	admin1 := r.Group("api/v1")
	{
		admin1.GET("/", v1.Demo)

	}

	admin2 := r.Group("api/v2")
	{
		admin2.GET("/", func(c *gin.Context) {
			res.Ask(c, 200, "api/v2正常")
		})

	}

	err := r.Run(":" + "8080") //运行端口
	log.Error(err)
}
